'''
请求网址:http://fanyi.youdao.com/translate_o?smartresult=dict&smartresult=rule
请求方法:POST
data = {
    'i':'翻译的内容'
    'doctype':'josn'
}
'''

import requests

url = 'http://fanyi.youdao.com/translate?smartresult=dict&smartresult=rule'
# 设置数据data
d = input('请输入翻译的内容：')
data = {
    'i': d,
    'doctype':"json"
}

# 发起请求
res = requests.post(url=url,data=data)
if res.status_code == 200:
    mess = res.json()
    print(mess['translateResult'][0][0]['tgt'])